package test04.demo02.tx1;

public class MyThread extends Thread {
    public String name;

    private int ticket = 50;
    public MyThread(String name) {
        this.name = name;
    }

    @Override
    public void run() {
            while (true) {
                if (ticket < 0) {
                    break;
                }
                String name = Thread.currentThread().getName();
                System.out.printf("%s 出售了第 %d 张电影票！%n", name, ticket);
                ticket -- ;
            }
    }
}
